import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../layout/Layout.vue'

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    redirect: "/house",
    meta: {
      title: '房屋出租系统'
    },
    children: [
      {
        path: 'meeting',
        name: 'Meeting',
        component: () => import("../views/Meeting"),
      },
      {
        path: 'wantRent',
        name: 'WantRent',
        component: () => import("../views/WantRent"),
      },
      {
        path: 'user',
        name: 'User',
        component: () => import("../views/User"),
      },
      {
        path: 'person',
        name: 'Person',
        component: () => import("../views/Person"),
      },
      {
        path: 'house',
        name: 'House',
        component: () => import("../views/House"),
      },
      {
        path: 'alreadyRent',
        name: 'AlreadyRent',
        component: () => import("../views/AlreadyRent"),
      },
    ]
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import("../views/Register"),
    meta: {
      title: '房屋出租系统'
    }
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import("../views/Login"),
    meta: {
      title: '房屋出租系统'
    }
  },

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
